package com.sg.hms.ServiceImpl;

import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.sg.hms.Dao.MoneyApplicationDao;
import com.sg.hms.DaoImpl.MoneyApplicationDaoImpl;
import com.sg.hms.Model.Applicationer;
import com.sg.hms.Service.MoneyApplicationService;

public class MoneyApplicationServiceImpl implements MoneyApplicationService{
	MoneyApplicationDao mDao = new MoneyApplicationDaoImpl();
	/**
	 * 查询各部门消费的服务
	 */
	@Override
	public JSONObject selectMoneyByPage(int pageStart, int pageSize, int total) {
		// TODO Auto-generated method stub
		return mDao.selectMoneyByPage(pageStart, pageSize, total);
	}
	
	/**
	 * 查询当前月各部门支出的数据总数
	 */
	@Override
	public int selectMoneyByNow() {
		// TODO Auto-generated method stub
		return mDao.selectMoneyByNowAndSate();
	}
	/**
	 *  根据日期查询某月的各部门申请批准的消费
	 */
	@Override
	public List<Applicationer> selectDeparTotalMoneyByDate(int pageStart,
			int pageSize, String date) {
		// TODO Auto-generated method stub
		return mDao.selectTotalMoneyByDate(pageStart, pageSize, date);
	}
	/**
	 * 根据日期查询某月的各部门申请批准的消费
	 */
	@Override
	public JSONObject selectMoneyByDate(int pageStart, int pageSize,String date) {
		// TODO Auto-generated method stub
		List<Applicationer> applicationers = mDao.selectMoneyByDate(pageStart, pageSize, date);//查询某月的各部门申请批准的消费
		int total = mDao.selectMoneyOfDataCountByDate(date);//根据日期查询某月的各部门申请批准的消费的数据条数
		JSONObject departSpendInfo = new JSONObject();
		departSpendInfo.put("rows", applicationers);
		departSpendInfo.put("total", total);
		return departSpendInfo;
	}


}
